Game Files/JSON
Game data is stored in several large files. The structure is described briefly here. Text User-visible text in several different languages is stored in files named BattleNations_*.json. When Z2 makes an incremental update to the game, they often put new text in Delta_*.json to reduce the size of the download. Units Statistics for combat units are stored in BattleUnits.json. Some of the interesting fields of the unit object are as follows. Ranks The stats array contains statistics that change as the unit gains ranks. Useful fields are: Prerequisites There are often various requirements that must be met before a unit can be trained. These are stored in a list of prereq objects, each of which has a type _t and other data. Here are some of the possible types. Attacks Unit attacks are somewhat complicated. Each unit has a list of weapons, and each weapon has a list of abilities. Ability statistics are stored in a separate file, BattleAbilities.json. Unit rank, weapon, and ability statistics are combined to produce the attack stats, as follows: mindmg = (floor(weapon.base_damage_min * ability.damageFromWeapon) + ability.damage) * (1 + (rank.power * ability.damageFromUnit * 0.02)) maxdmg = (floor(weapon.base_damage_max * ability.damageFromWeapon) + ability.damage) * (1 + (rank.power * ability.damageFromUnit * 0.02)) crit = (weapon.base_critPercent * ability.critFromWeapon) + ability.criticalHitPercent + (rank.critical * ability.critFromUnit) + ability.criticalBonusestarget_type offense = (weapon.base_ATK * ability.attackFromWeapon) + ability.attack + (rank.accuracy * ability.attackFromUnit) minrange = ability.minRange maxrange = ability.maxRange + weapon.rangeBonus Fractions are rounded down. A crit value of 5% is considered "normal"; the game does not display crit in the unit attack window if it is equal to 5%. Other useful fields in the weapon object are: All abilities on a weapon share the same ammo pool. Other useful fields in the ability object are: Status Effects Status effects like Stun and Poison are described in the file StatusEffectsConfig.json. Buildings Building information is in Compositions.json. Each building has a set of componentConfigs, many of which are optional. The StructureMenu block contains the building's name, icon, prereq, and cost to build. Construction contains the buildTime. Building size on the map is described by the Placeable block, which gives the building's width and height, and tells whether it isMoveable. Sellable contains the sell price. Population Houses make a contribution to the player's PopulationCapacity. Many buildings RequireWorkers. The number needed while the building is in operation is workers. Some buildings canToggle on and off. They need minWorkers for upkeep while they are turned off. Rewards Assistance gives the rewards for assisting another player's building. There is an interactionLimit to how many times a given building can be assisted per day. BattleReward gives the reward for raiding the building. The occupy reward is 3.8 times the raid reward, rounded up. Upgrades Some buildings can be upgraded. They have a BuildingUpgrade block which contains a list of levels. Each level has an upgradeCost and upgradeTime. There are several other fields in this block that influence the operation of the building, as explained below. Production The Taxes block describes buildings that automatically produce output on a certain schedule, such as houses, orchards, and the Supply Drop. It contains a paymentInterval, which gives the time in minutes (unlike most other times in the game files). The production output is given by rewards. Houses can be upgraded to increase the revenue generated. The produced is multiplied by the output percentage from the BuildingUpgrade section, and is multiplied by XPoutput. ResourceProducer buildings such as the Stone Quarry and Iron Mine generate output constantly, without the need for user interaction. The resource is identified by outputType, and it is produced at the given outputRate per hour, multiplied by the output percentage from BuildingUpgrade. JobList contains a list of jobs that can be made by shops, farms, ranches, and mills. This includes both regular goods and quest-related items. The demandCategory is unreliable, so consult Economy.json to be sure. Only the job identifiers are stored in Buildings.json; the full information is in JobInfo.json. The cost is multiplied by the input percentage from BuildingUpgrade, and the rewards are multiplied by output. The buildTime is in seconds, as usual. Healing Hospitals and repair bays contain a Healing block, which contains the messages displayed by certain actions. The BuildingUpgrade section has a number of important fields for healing buildings. The maximumHealingQueueSize tells how many units can be waiting for treatment (not counting the one currently being healed). Costs are multiplied by the input percentage, and time required is multiplied by time. Training ProjectList contains a list of units that the building can train. The level of the building required to train a unit is found in that unit's buildingLevel field, and the player level is in the prereq structure. Some units have a visibilityPrereq, and won't show up in the in-game build list until a certain condition is met (such as an active promotional offer). Defense DefenseStructure has information about structures that can participate in battles, including their radius and repairTime. The combat statistics are in the BattleUnits.json file, identified by unitId. Garrison buildings have a radius and unitCount. Bonus Decor Some decorations give a bonus to nearby buildings. The RadialMod block gives the stats that are affected and the radius of the buff. The tags field gives a list of building types that receive the bonus. There is usually a limit to the number of bonuses a building can receive. The maxModStack tells the maximum number of decors of exactly the same type that can affect a single building (only 3 Moats can stack modifiers, for example). In other cases, several different decorations may be in the same modCategory. For example, a Farm can't get bonuses from both a Water Tower and Concrete Reservoir, because they are both in the Irrigation category. Bonus categories are defined in RadialMod.json. Buildings that can be buffed have a RadialModBuffable block that tells which tags they repond to.